package com.itheima.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Slf4j
public class DemoAspect4 {
    @Around("@annotation(anno)")
    public Object around(ProceedingJoinPoint pjp,TestAnno anno) throws Throwable {
        String targetName = pjp.getTarget().getClass().getName();
        Signature signature = pjp.getSignature();
        String methodName = signature.getName();
        Object[] args = pjp.getArgs();
        log.info("targetName:{},signature:{},methodName:{},args:{}",targetName,signature,methodName,args);
        Object proceed = pjp.proceed();
        return proceed;
    }
}
